<?php
/**
 * Created by PhpStorm.
 * User: edmmss
 * Date: 2019/1/15
 * Time: 09:26
 */

namespace app\modules\strategy;


class DateComparator implements ComparatorInterface
{
    /**
     * className
     *
     * @date   2019/1/15
     * @author edmmss
     * @param $a
     * @param $b
     * @return int
     */
    public function compare($a, $b): int
    {
        // TODO: Implement compare() method.
        $aDate = new \DateTime($a['date']);
        $bDate = new \DateTime($b['date']);

        return $aDate <=> $bDate;
    }
}